<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    new Promise((resolve, reject) => {
      console.log('开始请求数据A')
        try {
          throw new Error('获取数据A失败')
          setTimeout(() => {
            console.log('获取A数据成功')
            resolve('ok')
          }, 2000)
        } catch (e) {
          reject(e.message)
        }
      })

      .then((value) => {
        return new Promise((resolve, reject) => {
          console.log('开始请求数据B')
          try {  
            setTimeout(() => {
              console.log('获取数据B成功')
              resolve('okok')
            }, 2000)
          } catch (e) {
            reject(e.message)
          }
        })
      })

      .catch((value) => {
        console.log('出错了!!!');
      })
  </script>
</body>

</html>